#include "expression.h"

Expression::Expression(const string& str) : Constante(EXPRESSION){
    this->type = EXPRESSION;
    this->str = str;
    this->str[0]= ' ';
    this->str[this->str.size()-1]= ' ';
}

Constante* Expression::operator+(const Constante& c)const{
    return new Expression("'"+c.print()+str+"+'");
}

Constante* Expression::operator*(const Constante& c)const{
    return new Expression("'"+c.print()+str+"*'");
}

Constante* Expression::operator-(const Constante& c)const{
    return new Expression("'"+c.print()+str+"-'");
}

Constante* Expression::operator/(const Constante& c)const{
    return new Expression("'"+c.print()+str+"/'");
}

std::string Expression::print()const{
    return "'"+str+"'";
}

Constante* Expression::operator-()const{
    return new Expression("'"+str+"SIGN'");
}
